﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TuanAnhPersonalWeb.Models;

namespace TuanAnhPersonalWeb.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        TuanAnhEntities _entities = new TuanAnhEntities();
        public ActionResult Index()
        {
            IEnumerable<TUANANH__CONTENT> content = _entities.TUANANH__CONTENT; 
            return View(content);
        }

        public ActionResult News()
        {
            var newsdata =
                _entities.TUANANH__CONTENT.Where(x => x.TYPE_ID == 2).OrderByDescending(c => c.CREATEDATE).Take(3);

            return View(newsdata);
        }

        public ActionResult AboutUs()
        {
            var aboutus = _entities.TUANANH__CONTENT.SingleOrDefault(x => x.TYPE_ID == 1);
            return View(aboutus);
        }

        public  ActionResult DetailNew(int contentid)
        {
            var detail = _entities.TUANANH__CONTENT.SingleOrDefault(x => x.CONTENT_ID == contentid);
            return View(detail);
        }

    }
}
